Method and apparatus for encoding and decoding image through intra prediction

ABSTRACT

A method and apparatus for encoding and decoding an image through intra prediction using a pixel of the neighboring block along an extended line having a predetermined gradient about a pixel inside the current block.

CROSS-REFERENCE TO RELATED PATENT APPLICATION

This application is a Continuation application of U.S. application Ser.No. 13/184,096 filed Jul. 15, 2011, which claims the benefits of U.S.Provisional Patent Application No. 61/364,986, filed on Jul. 16, 2010,in the United States Patent and Trademark Office, and priority fromKorean Patent Application No. 10-2010-0097424, filed on Oct. 6, 2010, inthe Korean Intellectual Property Office, the disclosures of which areherein incorporated by reference in their entireties.

BACKGROUND

1. Field

Exemplary embodiments of the present disclosure relate to encoding anddecoding of an image, and more particularly, to a method and apparatusfor encoding and decoding an image through intra prediction which mayimprove image compression efficiency by using intra prediction modeshaving various directivities.

2. Description of the Related Art

According to an image compression standard, such as moving pictureexpert group (MPEG)-1, MPEG-2, MPEG-4, or H.264/MPEG-4 advanced videocoding (AVC), a picture is split into macroblocks to encode an image.After each of the macroblocks is encoded in any of inter prediction andintra prediction encoding modes, an appropriate encoding mode isselected according to a bit rate required for encoding the macroblockand an allowable distortion between the original macroblock and thereconstructed macroblock, and then the macroblock is encoded in theselected encoding mode.

As hardware for reproducing and storing high resolution or high qualityimage content is being developed, a need for a video codec thateffectively encodes or decodes the high resolution or high quality videocontent is increasing. In a conventional video codec, a video is encodedin a limited encoding mode based on a macroblock having a predeterminedsize.

SUMMARY

The exemplary embodiments provide a method and apparatus for encodingand decoding an image through intra prediction by using intra predictionmodes having various directivities.

The exemplary embodiments also provide a method and apparatus forencoding and decoding an image through intra prediction which may reducethe amount of calculation performed during the intra prediction.

According to an aspect of an exemplary embodiment, there is provided amethod of intra prediction encoding an image, the method including:dividing a current picture of the image into at least one block having apredetermined size; determining, from among pixels of a neighboringblock previously reconstructed before a pixel of the at least one block,a pixel of the neighboring block along an extended line having apredetermined gradient about the pixel of the at least one block; andpredicting the pixel of the at least one block using the determinedpixel of the neighboring block.

According to another aspect of an exemplary embodiment, there isprovided a method of intra prediction decoding an image, the methodincluding: dividing a current picture of the image into at least oneblock having a predetermined size; extracting intra prediction modeinformation that indicates an intra prediction mode applied to the atleast one block from a bitstream; and performing intra prediction on theat least one block according to the intra prediction mode indicated bythe extracted intra prediction mode information, wherein in the intraprediction mode, a pixel of a neighboring block predicts a pixel of theat least one block, the pixel of the neighboring block determined fromamong pixels of the neighboring block previously reconstructed beforethe pixel of the at least one block using an extended line having apredetermined gradient about the pixel of the at least one block.

According to another aspect of an exemplary embodiment, there isprovided apparatus for intra prediction encoding an image, the apparatusincluding an intra prediction unit that determines a pixel of aneighboring block from among pixels of the neighboring block which arepreviously reconstructed before a pixel of a current block of the imageusing an extended line having a predetermined gradient about the pixelof the current block, and predicts the pixel of the current block usingthe determined pixel of the neighboring block.

According to another aspect of an exemplary embodiment, there isprovided an apparatus for intra prediction decoding an image, theapparatus including an intra prediction unit that extracts intraprediction mode information that indicates an intra prediction modeapplied to a current block of the image from a bitstream and performsintra prediction on the current block according to the intra predictionmode indicated by the extracted intra prediction mode information,wherein in the intra prediction mode, a pixel of a neighboring blockpredicts a pixel of the current block, the pixel of the neighboringblock determined from among pixels of the neighboring block previouslyreconstructed before the pixel of the current block using an extendedline having a predetermined gradient about the pixel of the currentblock.

Since intra prediction is performed in various directions, imagecompression efficiency may be improved.

The amount of calculation performed to determine a reference pixelduring intra prediction may be reduced.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other aspects will become more apparent by describing indetail exemplary embodiments thereof with reference to the attacheddrawings in which:

FIG. 1 is a block diagram illustrating an apparatus for encoding animage, according to an exemplary embodiment;

FIG. 2 is a diagram illustrating a number of intra prediction modesaccording to a size of a current block, according to an exemplaryembodiment;

FIG. 3 is a diagram for explaining intra prediction modes applied to ablock having a predetermined size, according to an exemplary embodiment;

FIG. 4 is a diagram illustrating directions of the intra predictionmodes of FIG. 3, according to an exemplary embodiment;

FIG. 5 is a diagram for explaining an intra prediction method performedon the block illustrated in FIG. 3, according to an exemplaryembodiment;

FIG. 6 is a diagram for explaining intra prediction modes applied to ablock having a predetermined size, according to another exemplaryembodiment;

FIG. 7 is a reference diagram for explaining intra prediction modeshaving various directivities, according to an exemplary embodiment;

FIG. 8 is a reference diagram for explaining a process of generating apredictor when an extended line having a predetermined gradient passesbetween, not through, neighboring pixels of integer locations, accordingto an exemplary embodiment;

FIG. 9 is a reference diagram for explaining a process of generating apredictor when an extended line having a predetermined gradient passesbetween neighboring pixels of integer locations, according to anotherexemplary embodiment;

FIG. 10 is a reference diagram for explaining a bilinear mode accordingto an exemplary embodiment;

FIG. 11 is a diagram for explaining a process of generating a predictionvalue of an intra prediction mode of a current block, according to anexemplary embodiment;

FIGS. 12 and 13 are reference diagrams for explaining a mapping processfor unifying intra prediction modes of blocks having different sizes,according to exemplary embodiments;

FIG. 14 is a reference diagram for explaining a process of mapping intraprediction modes of a neighboring block to one of representative intraprediction modes, according to an exemplary embodiment;

FIG. 15 is a diagram for explaining a relationship between a currentpixel and neighboring pixels located on an extended line having adirectivity (dx, dy), according to an exemplary embodiment;

FIG. 16 is a diagram for explaining a change in a neighboring pixellocated on an extended line having a directivity (dx, dy) according to alocation of a current pixel, according to an exemplary embodiment;

FIGS. 17 and 18 are diagrams for explaining a method of determining anintra prediction mode direction, according to exemplary embodiments;

FIG. 19 is a flowchart illustrating a method of encoding an imagethrough intra prediction, according to an exemplary embodiment;

FIG. 20 is a block diagram illustrating an apparatus for decoding animage, according to an exemplary embodiment; and

FIG. 21 is a flowchart illustrating a method of decoding an imagethrough intra prediction, according to an exemplary embodiment.

DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS

The exemplary embodiments will now be described more fully withreference to the accompanying drawings, in which the exemplaryembodiments are shown.

FIG. 1 is a block diagram illustrating an apparatus 100 for encoding animage, according to an exemplary embodiment.

Referring to FIG. 1, the apparatus 100 includes an intra prediction unit110, a motion estimation unit 120, a motion compensation unit 125, afrequency transformation unit 130, a quantization unit 140, an entropyencoder 150, an inverse quantization unit 160, a frequencyinverse-transformation unit 170, a deblocking unit 180, and a loopfiltering unit 190.

The motion estimation unit 120 and the motion compensation unit 125perform inter prediction that divides a current frame 105 of a currentpicture into blocks, each having a predetermined size, and searches fora prediction value of each of the blocks in a reference picture.

The intra prediction unit 110 performs intra prediction that searchesfor a prediction value of a current block by using pixels of neighboringblocks of a current picture. In particular, the intra prediction unit110 additionally performs intra prediction modes having variousdirectivities by using (dx, dy) parameters in addition to a conventionalintra prediction mode. The added intra prediction modes according to thepresent exemplary embodiment will be explained later.

Residual values of the current block are generated based on a predictionvalue output from the intra prediction unit 110 and the motioncompensation unit 125, and are output as quantized transformcoefficients through the frequency transformation unit 130 and thequantization unit 140.

The quantized transform coefficients are restored to residual valuesthrough the inverse quantization unit 160 and the frequencyinverse-transformation unit 170, and the restored residual values arepost-processed through the deblocking unit 180 and the loop filteringunit 190 and are output to a reference frame 195. The quantizedtransform coefficients may be output as a bitstream 155 through theentropy encoder 150.

Intra prediction performed by the intra prediction unit 110 of FIG. 1will be explained in detail. An intra prediction method for improvingimage compression efficiency will be explained by assuming a codec thatmay perform compression encoding by using a block having a size greateror less than 16×16 as a coding unit, not a conventional codec such asH.264 that performs encoding based on a macroblock having a size of16×16.

FIG. 2 is a diagram illustrating a number of intra prediction modesaccording to a size of a current block, according to an exemplaryembodiment.

A number of intra prediction modes to be applied to a block may varyaccording to a size of the block. For example, referring to FIG. 2, whena size of a block to be intra-predicted is N×N, a number of intraprediction modes actually performed on each of blocks having respectivesizes of 2×2, 4×4, 8×8, 16×16, 32×32, 64×64, and 128×128 may be set tobe 5, 9, 9, 17, 33, 5, and 5 (in the case of Example 2). As such, anumber of intra prediction modes actually performed varies according toa size of a block, since overhead for encoding prediction modeinformation varies according to the size of the block. In other words,in the case of a block having a small size, although the block occupiesa small part of an entire image, overhead for transmitting additionalinformation, such as a prediction mode of the block having the smallsize, may be high. Accordingly, if a block having a small size isencoded by using too many prediction modes, a bit rate may be increased,thereby reducing compression efficiency. Also, since a block having alarge size, for example, a size greater than 64×64, is often selected asa block for a flat area of an image, when the block having the largesize is encoded by using too many prediction modes, compressionefficiency may also be reduced.

Accordingly, in FIG. 2, if sizes of blocks are roughly classified intoat least three sizes N1×N1(2≦N1≦8, N1 is an integer), N2×N2(16≦N2≦32, N2is an integer), and N3×N3(64≦N3, N3 is an integer), a number of intraprediction modes to be performed on the block having the size of N1×N1is A1 (A1 is a positive integer), a number of intra prediction modes tobe performed on the block having the size of N2×N2 is A2 (A2 is apositive integer), and a number of intra prediction modes to beperformed on the block having the size of N3×N3 is A3 (A3 is a positiveinteger), it is preferable that a number of intra prediction modes to beperformed according to a size of each block is set to satisfy arelationship of A3≦A1 ≦A2. That is, when a current picture is roughlydivided into a block having a small size, a block having an intermediatesize, and a block having a large size, it is preferable that the blockhaving the intermediate size is set to have a greatest number ofprediction modes, and the block having the small size and the blockhaving the large size are set to have a relatively small number ofprediction modes. However, the present exemplary embodiment is notlimited thereto, and the block having the small size and the blockhaving the large size may be set to have a great number of predictionmodes. A number of prediction modes varying according to a size of eachblock illustrated in FIG. 2 is an example, and may be changed.

FIG. 3 is a diagram for explaining intra prediction modes applied to ablock having a predetermined size, according to an exemplary embodiment.

Referring to FIGS. 2 and 3, when intra prediction is performed on ablock having a size of 4×4, the block having the size of 4×4 may have avertical mode (mode 0), a horizontal mode (mode 1), a direct current(DC) mode (mode 2), a diagonal down left mode (mode 3), a diagonal downright mode (mode 4), a vertical right mode (mode 5), a horizontal downmode (mode 6), a vertical left mode (mode 7), and a horizontal up mode(mode 8).

FIG. 4 is a diagram illustrating directions of the intra predictionmodes of FIG. 3, according to an exemplary embodiment. In FIG. 4, anumeral shown at an end of an arrow denotes a corresponding mode valuewhen prediction is performed in a direction marked by the arrow. Here,the mode 2 is a DC prediction mode with no directivity, and thus is notshown.

FIG. 5 is a diagram for explaining an intra prediction method performedon the block illustrated in FIG. 3, according to an exemplaryembodiment.

Referring to FIG. 5, a prediction block is generated by usingneighboring pixels A-M of a current block in an available intraprediction mode determined by a size of a block. For example, anoperation of prediction-encoding a current block having a size of 4×4 inthe mode 0 of FIG. 3, that is, the vertical mode, will be explained.First, pixel values of pixels A through D adjacent above the currentblock having the size of 4×4 are predicted to be pixel values of thecurrent block having the size of 4×4. That is, a pixel value of thepixel A is predicted to be pixel values of four pixels included in afirst column of the current block having the size of 4×4, a pixel valueof the pixel B is predicted to be pixel values of four pixels includedin a second column of the current block having the size of 4×4, a pixelvalue of the pixel C is predicted to be pixel values of four pixelsincluded in a third column of the current block having the size of 4×4,and a pixel value of the pixel D is predicted to be pixel values of fourpixels included in a fourth column of the current block having the sizeof 4×4. Next, a residual between actual pixel values of pixels includedin the original 4×4 current block and pixel values of pixels included inthe 4×4 current block predicted by using the pixels A through D isobtained and encoded.

FIG. 6 is a diagram for explaining intra prediction modes applied to ablock having a predetermined size, according to another exemplaryembodiment.

Referring to FIGS. 2 and 6, when intra prediction is performed on ablock having a size of 2×2 or 128×128, the block having the size of 2×2or 128×128 may have 5 modes: a vertical mode, a horizontal mode, a DCmode, a plane mode, and a diagonal down right mode.

Meanwhile, if a block having a size of 32×32 includes 33 intraprediction modes as shown in FIG. 2, it is necessary to set directionsof the 33 intra prediction modes. In order to set intra prediction modeshaving various directions other than the intra prediction modesillustrated in FIGS. 4 and 6, a prediction direction for selecting aneighboring pixel to be used as a reference pixel about a pixel in ablock is set by using (dx, dy) parameters. For example, when each of the33 prediction modes is represented as a mode N (N is an integer from 0to 32), a mode 0 may be set to be a vertical mode, a mode 1 may be setto be a horizontal mode, a mode 2 may be set to be a DC mode, a mode 3may be set to be a plane mode, and each of a mode 4 through a mode 32may be set to be a prediction mode having a directivity of tan⁻¹(dy/dx)represented as one of (dx, dy) that is expressed as one of (1,-1),(1,1), (1,2), (2,1), (1,-2), (2,1), (1,-2), (2,-1), (2,-11), (5,-7),(10,-7), (11,3), (4,3), (1,11), (1,-1), (12,-3), (1,-11), (1,-7),(3,-10), (5,-6), (7,-6), (7,-4), (11,1), (6,1), (8,3), (5,3), (5,7),(2,7), (5,-7), and (4,-3) as shown in Table 1.

TABLE 1 mode # dx dy mode 4 1 −1 mode 5 1 1 mode 6 1 2 mode 7 2 1 mode 81 −2 mode 9 2 −1 mode 10 2 −11 mode 11 5 −7 mode 12 10 −7 mode 13 11 3mode 14 4 3 mode 15 1 11 mode 16 1 −1 mode 17 12 −3 mode 18 1 −11 mode19 1 −7 mode 20 3 −10 mode 21 5 −6 mode 22 7 −6 mode 23 7 −4 mode 24 111 mode 25 6 1 mode 26 8 3 mode 27 5 3 mode 28 5 7 mode 29 2 7 mode 30 5−7 mode 31 4 −3 The mode 0 is a vertical mode, the mode 1 is ahorizontal mode, the mode 2 is a DC mode, the mode 3 is a plane mode,and the mode 32 is a bilinear mode.

A last mode 32 may be set to be a bilinear mode using bilinearinterpolation as will be described later with reference to FIG. 10.

FIG. 7 is a reference diagram for explaining intra prediction modeshaving various directivities, according to an exemplary embodiment.

As described with reference to Table 1, intra prediction modes may havevarious directivities of tan⁻¹(dy/dx) by using a plurality of (dx, dy)parameters.

Referring to FIG. 7, neighboring pixels A and B located on an extendedline 700 having a gradient of tan⁻¹(dy/dx) that is determined accordingto (dx, dy) of each mode shown in Table 1 about a current pixel P to bepredicted in a current block may be used as a predictor for the currentpixel P. In this case, it is preferable that the neighboring pixels Aand B used as a predictor are pixels of neighboring block at up, left,right up, and left down sides of the current block, which are previouslyencoded and restored. Also, if the extended line 700 passes between, notthrough, neighboring pixels of integer locations, neighboring pixelscloser to the current pixel P from among neighboring pixels close to theextended line 700 may be used as a predictor, or prediction may beperformed by using neighboring pixels close to the extended line 700.For example, an average value between neighboring pixels close to theextended line 700, or a weighted average value considering a distancebetween an intersection of the extended line 700 and neighboring pixelsclose to the extended line 700 may be used as a predictor for thecurrent pixel P. Also, as shown in FIG. 7, it may be signaled in unitsof blocks which neighboring pixels, e.g., the neighboring pixels A andB, are to be used as a predictor for the current pixel P from amongneighboring pixels on an X-axis and neighboring pixels on a Y-axis whichare available according to prediction directions.

FIG. 8 is a reference diagram for explaining a process of generating apredictor when an extended line 800 having a predetermined gradientpasses between, not through, neighboring pixels of integer locations,according to an exemplary embodiment.

Referring to FIG. 8, if the extended line 800 having an angle oftan⁻¹(dy/dx) that is determined according to (dx, dy) of each modepasses between a neighboring pixel A 810 and a neighboring pixel B 820of integer locations, a weighted average value considering a distancebetween an intersection of the extended line 800 and the neighboringpixels A 810 and B 820 close to the extended line 800 may be used as apredictor for the current pixel P as described above. For example, whena distance between the intersection of the extended line 800 having theangle of tan⁻¹(dy/dx) and the neighboring pixel A 810 is f and adistance between the intersection of the extended line 800 and theneighboring pixel B 820 is g, a predictor for the current pixel P may beobtained as (A*g+B*f)/(f+g). Here, it is preferable that f and g may beeach a normalized distance using an integer. If software or hardware isused, the predictor for the current pixel P may be obtained by shiftoperation as (g*A+f*B+2)>>2. As shown in FIG. 8, if the extended line800 passes through a first quarter close to the neighboring pixel A 810from among four parts obtained by quartering a distance between theneighboring pixel A 810 and the neighboring pixel B 820 of the integerlocations, the predictor for the current pixel P may be obtained as(3*A+B)/4. Such operation may be performed by shift operationconsidering rounding off to a nearest integer like (3*A+B+2)>>2.

FIG. 9 is a reference diagram for explaining a process of generating apredictor when an extended line having a predetermined gradient passesbetween neighboring pixels of integer locations, according to anotherexemplary embodiment.

Referring to FIG. 9, if an extended line having an angle of tan⁻¹(dy/dx)that is determined according to (dx, dy) of each mode passes between aneighboring pixel A 910 and a neighboring pixel B 920 of integerlocations, a section between the neighboring pixel A 910 and theneighboring pixel B 920 may be divided into a predetermined number ofareas, and a weighted average value considering a distance between anintersection and the neighboring pixel A 910 and the neighboring pixel B920 in each divided area may be used as a prediction value. For example,a section between the neighboring pixel A 910 and the neighboring pixelB 920 may be divided into five sections P1 through P5 as shown in FIG.9, a representative weighted average value considering a distancebetween an intersection and the neighboring pixel A 151 and theneighboring pixel B 152 in each section may be determined, and therepresentative weighted average value may be used as a predictor for thecurrent pixel P. In detail, if an extended line passes through thesection P1, a value of the neighboring pixel A 910 may be determined asa predictor for the current pixel P. If an extended line passes throughthe section P2, a weighted average value (3*A+1*B+2)>>2 considering adistance between the neighboring pixel A 910 and the neighboring pixel920 and a middle point of the section P2 may be determined as apredictor for the current pixel P. If an extended line passes throughthe section P3, a weighted average value (2*A+2*B+2)>>2 considering adistance between the neighboring pixel A 910 and the neighboring pixel B920 and a middle point of the section P3 may be determined as apredictor for the current pixel P. If an extended line passes throughthe section P4, a weighted average value (1*A+3*B+2)>>2 considering adistance between the neighboring pixel A 910 and the neighboring pixel B920 and a middle point of the section P4 may be determined as apredictor for the current pixel P. If an extended line passes throughthe section P5, a value of the neighboring pixel B 920 may be determinedas a predictor for the current pixel P.

Also, if two neighboring pixels, that is, the neighboring pixel A on theup side, and the neighboring pixel B on the left side meet the extendedline 700 as shown in FIG. 7, an average value of the neighboring pixel Aand the neighboring pixel B may be used as a predictor for the currentpixel P. Alternatively, if (dx*dy) is a positive value, the neighboringpixel A on the up side may be used, and if (dx*dy) is a negative value,the neighboring pixel B on the left side may be used.

It is preferable that intra prediction modes having variousdirectivities, as shown in Table 1, are previously set at an encodingend and a decoding end, and only a corresponding index of an intraprediction mode set for each block is transmitted.

FIG. 10 is a reference diagram for explaining a bilinear mode accordingto an exemplary embodiment.

Referring to FIG. 10, in a bilinear mode, a geometric average valueconsidering distances to up, down, left, and right borders of thecurrent pixel P and pixels located at the up, down, left, and rightborders about the current pixel P to be predicted in a current block iscalculated, and a result of the calculation is used as a predictor forthe current pixel P. That is, in a bilinear mode, a geometric averagevalue of distances to up, down, left, and right borders of the currentpixel P and a pixel A 1061, a pixel B 1002, a pixel D 1006, and a pixelE 1007 which are located at the up, down, left, and right borders of thecurrent pixel P may be used as a predictor for the current pixel P 1060.In this case, since the bilinear mode is one of intra prediction modes,neighboring pixels on up and left sides which are previously encoded andthen restored should also be used as reference pixels during prediction.Accordingly, corresponding pixel values in the current block are notused as the pixel A 1061 and the pixel B 1002, but virtual pixel valuesgenerated by using neighboring pixels on up and sides are used.

In detail, a virtual pixel C 1003 at a right down side of a currentblock is calculated by using an average value of a neighboring pixelRightUpPixel 1004 at a right up side and a neighboring pixelLeftDownPixel 1005 at a left down side adjacent to the current block asshown in Equation 1.

C=0.5(DownPixel+UpPixel)   [Equation 1]

Equation 1 may be calculated by shift operation as

C=0.5(LeftDownPixel+RightUpPixel+1)>>1.

When the current pixel P 1060 is extended downward by considering adistance W1 to the left border and a distance W2 to the right border ofthe current pixel P 1060, a value of the virtual pixel A 1061 located onthe down border may be set by using an average value of the neighboringpixel LeftDownPixel 1005 at a left down side and the pixel C 1003. Forexample, the value of the pixel A 1061 may be calculated by using oneequation shown in Equation 2.

A=(C*W1+DownPixel*W2)/(W1+W2) A=(C*W1+DownPixel*W2+((W1+W2)/2))/(W1+W2)  [Equation 2]

In Equation 2, when a value of W1+W2 is a power of 2 like 2̂n,A=(C*W1+LeftDownPixel*W2+((W1+W2)/2))/(W1+W2) may be calculated by shiftoperation as A=(C*W1+LeftDownPixel*W2+2̂(n−1))>>n without division.

Likewise, when the current pixel P 1060 is extended rightward byconsidering a distance h1 to the upper border of the current pixel P1060 and a distance h2 to the lower border of the current pixel P 1060,a value of a virtual pixel B 1002 located on the right border may be setby using an average value of the neighboring pixel RightUpPixel 1004 ona right up side and the pixel C 1003 by considering the distances h1 andh2. For example, the value of the pixel B 1002 may be calculated byusing one equation shown in Equation 3.

B=(C*h1+UpPixel*h2)/(h1+h2); B=(C*h1+UpPixel*h2+((h1+h2)/2))/(h1+h2)  [Equation 3]

In Equation 3, when a value of h1+h2 is a power of 2 like 2̂m,B=(C*h1+RightUpPixel*h2+((h1+h2)/2))/(h1+h2) may be calculated by shiftoperation as B=(C*h1 +RightUpPixel*h2+2̂(m−1))>>m without a division.

Once the values of the virtual pixel A 1061 on the down border of thecurrent pixel P 1060 and the virtual pixel B 1002 on the right border ofthe current pixel P 1060 are determined by using Equations 1 through 3,a predictor for the current pixel P 1060 may be determined by using anaverage value of A+B+D+E. In detail, a weighted average valueconsidering a distance between the current pixel P 1060 and the virtualpixel A 1061, the virtual pixel B 1002, the pixel D 1006, and the pixelE 1007, or an average value of A+B+D+E may be used as a predictor forthe current pixel P 1060. For example, if a size of a block of FIG. 10is 16×16 and a weighted average value is used, a predictor for thecurrent pixel P 1060 may be obtained as (h1*A+h2*D+W1*B+W2*E+16)>>5. Assuch, such bilinear prediction is applied to all pixels in a currentblock, and a prediction block of the current block in a bilinearprediction mode is generated.

Since prediction encoding is performed according to intra predictionmodes that vary according to a size of a block, more efficientcompression may be achieved according to characteristics of an image.

Meanwhile, since a greater number of intra prediction modes than intraprediction modes used in a conventional codec are used according to thepresent exemplary embodiment, compatibility with the conventional codecmay become a problem. Accordingly, it may be necessary to map availableintra prediction modes having various directions to one of a smallernumber of intra prediction modes. That is, when a number of availableintra prediction modes of a current block is N1 (N1 is an integer), inorder to make the available intra prediction modes of the current blockcompatible with a block having N2 (N2 is an integer different from N1)intra prediction modes, the intra prediction modes of the current blockmay be mapped to an intra prediction mode having a most similardirection from among the N2 intra prediction modes. For example, it isassumed that a total of 33 intra prediction modes are available in thecurrent block as shown in Table 1 and an intra prediction mode finallyapplied to the current block is the mode 14, that is, (dx, dy)=(4,3),having a directivity of tan⁻¹(3/4)≈36.87(degrees). In this case, inorder to match the intra prediction mode applied to the current block toone of 9 intra prediction modes as shown in FIG. 4, the mode 4 (downright) having a most similar directivity to the directivity of 36.87(degrees) may be selected. That is, the mode 14 in Table 1 may be mappedto the mode 4 illustrated in FIG. 4. Likewise, if an intra predictionmode applied to the current block is selected to be the mode 15, thatis, (dx, dy)=(1,11), from among the 33 available intra prediction modesof Table 1, since a directivity of the intra prediction mode applied tothe current block is tan⁻¹(11)≈84.80 (degrees), the mode 0 (vertical) ofFIG. 4 having a most directivity to the directivity of 84.80 (degrees)may be mapped to the mode 15.

Meanwhile, in order to decode a block encoded through intra prediction,prediction mode information about through which intra prediction mode acurrent block is encoded is required. Accordingly, when an image isencoded, information about an intra prediction mode of a current blockis added to a bitstream, and at this time, if the information about theintra prediction mode is added as it is to the bitstream for each block,overhead is increased, thereby reducing compression efficiency.Accordingly, the information about the intra prediction mode of thecurrent block that is determined as a result of encoding of the currentblock may not be transmitted as it is, but only a difference valuebetween a value of an actual intra prediction mode and a predictionvalue of an intra prediction mode predicted from neighboring blocks maybe transmitted.

If intra prediction modes having various directions are used accordingto the present exemplary embodiment, a number of available intraprediction modes may vary according to a size of a block. Accordingly,in order to predict an intra prediction mode of a current block, it isnecessary to map intra prediction modes of neighboring blocks torepresentative intra prediction modes. Here, it is preferable that therepresentative intra prediction modes may be a smaller number of intraprediction modes from among intra prediction modes of availableneighboring blocks, or 9 intra prediction modes as shown in FIG. 14.

FIG. 11 is a diagram for explaining a process of generating a predictionvalue of an intra prediction mode of a current block, according to anexemplary embodiment.

Referring to FIG. 11, when a current block is A 110, an intra predictionmode of the current block A 110 may be predicted from intra predictionmodes determined from neighboring blocks. For example, if a determinedintra prediction mode determined from a left block B 111 of the currentblock A 110 is a mode 3 and an intra prediction mode determined from anup block C 112 is a mode 4, an intra prediction mode of the currentblock A 110 may be predicted to be the mode 3 having a smaller valuefrom among the prediction modes of the up block C 112 and the left blockB 111. If an intra prediction mode determined as a result of actualintra prediction encoding performed on the current block A 110 is a mode4, only a difference 1 from the mode 3 that is a value of the intraprediction mode predicted from the neighboring blocks B 111 and C 112 istransmitted as intra prediction mode information. When an image isdecoded, in the same manner, a prediction value of an intra predictionmode of a current block is generated, a mode difference valuetransmitted through a bitstream is added to the prediction value of theintra prediction mode, and intra prediction mode information actuallyapplied to the current block is obtained. Although only the neighboringblocks located on the upper and left sides of the current block areused, an intra prediction mode of the current block A 110 may bepredicted by using other neighboring blocks as shown in FIG. 11E andFIG. 11D.

Meanwhile, since intra prediction modes actually performed varyaccording to a size of a block, an intra prediction mode predicted fromneighboring blocks may not be matched to an intra prediction mode of acurrent block. Accordingly, in order to predict an intra prediction modeof a current block from neighboring blocks having different sizes, amapping process of unifying intra prediction modes of the blocks havingdifferent intra prediction modes is required.

FIGS. 12 and 13 are reference diagrams for explaining a mapping processfor unifying intra prediction modes of blocks having different sizes,according to exemplary embodiments.

Referring to FIG. 12, it is assumed that a current block A 120 has asize of 16×16, a left block B 121 has a size of 8×8, and an upper blockC 122 has a size of 4×4. Also, as shown in Example 1 of FIG. 2, it isassumed that numbers of available intra prediction modes of the blockshaving the sizes of 4×4, 8×8, and 16×16 are 9, 9, and 33. In this case,since the numbers of the available intra prediction modes of the leftblock B 121 and the upper block C 122 are different from the number ofthe available intra prediction modes of the current block A 120, anintra prediction mode predicted from the left block B 121 and the upblock C 122 is not suitable to be used as a prediction value of an intraprediction mode of the current block A 120. Accordingly, in FIG. 12,intra prediction modes of the neighboring block B 121 and theneighboring block C 122 are respectively changed to first and secondrepresentative intra prediction modes having a most similar directionfrom among a predetermined number of representative intra predictionmodes as shown in FIG. 14, and a mode having a smaller mode value isselected from the first and second representative intra prediction modesas a final representative intra prediction mode. An intra predictionmode having a most similar direction to the final representative intraprediction mode selected from the intra prediction modes availableaccording to a size of the current block A 120 is predicted to be anintra prediction mode of the current block A 120.

Alternatively, referring to FIG. 13, it is assumed that a current blockA 130 has a size of 16×16, a left block B 133 has a size of 32×32, andan upper block C 132 has a size of 8×8. Also, as shown in Example 1 ofFIG. 2, it is assumed that numbers of available intra prediction modesof the blocks having the sizes of 8×8, 16×16, and 32×32 are 9, 9, and32. Also, it is assumed that an intra prediction mode of the left blockB 133 is a mode 4, and an intra prediction mode of the upper block C 132is a mode 31. In this case, since the intra prediction modes of the leftblock B 133 and the up block C 132 are not compatible with each other,each of the intra prediction modes of the left block B 133 and the upperblock C 132 is mapped to one of representative intra prediction modes,as shown in FIG. 14. Since the mode 31 that is the intra prediction modeof the left block B 133 has a directivity of (dx, dy)=(4, −3) as shownin Table 1, the mode 31 is mapped to a mode 5 having a most similardirectivity to tan⁻¹(−3/4) from among the representative intraprediction modes of FIG. 14, and since the mode 4 has the samedirectivity as that of a mode 4 from among the representative intraprediction modes of FIG. 14, the mode 4 that is the intra predictionmode of the upper block C 132 is mapped to the mode 4.

Next, the mode 4 having a smaller mode value from among the mode 5 thatis the mapped intra prediction mode of the left block B 133 and the mode4 that is the mapped intra prediction mode of the up block C 132 may bedetermined to be a prediction value of an intra prediction mode of thecurrent block A 130, and only a mode difference value between an actualintra prediction mode and a predicted intra prediction mode of thecurrent block A 130 may be encoded as prediction mode information of thecurrent block A 130.

FIG. 14 is a reference diagram for explaining a process of mapping intraprediction modes of neighboring blocks to one of representative intraprediction modes, according to an exemplary embodiment. In FIG. 14, asrepresentative intra prediction modes, a vertical mode 0, a horizontalmode 1, a DC mode (not shown), a diagonal down left mode 3, a diagonaldown right mode 4, a vertical right mode 5, a horizontal down mode 6, avertical left mode 7, and a horizontal up mode 8 are set. However, therepresentative intra prediction modes are not limited thereto and may beset to have a various number of directivities.

Referring to FIG. 14, a predetermined number of representative intraprediction modes are previously set, and intra prediction modes ofneighboring blocks are mapped to a representative intra prediction modehaving a most similar direction. For example, if a determined intraprediction mode of a neighboring block is an intra prediction modeMODE_A 140 having a directivity, the intra prediction mode MODE_A 140 ofthe neighboring block is mapped to MODE 1 having a most similardirection from among 9 preset representative intra prediction modes 1through 9. If a determined intra prediction mode of a neighboring blockis an intra prediction mode MODE_B 141 having a directivity, the intraprediction mode MODE_B 141 of the neighboring block is mapped to MODE 5having a most similar direction from among the 9 preset representativeintra prediction modes 1 through 9.

As such, if available intra prediction modes of neighboring blocks arenot the same, the intra prediction modes of the neighboring blocks aremapped to representative intra prediction modes, and an intra predictionmode having a smallest mode value is selected as a final representativeintra prediction mode of the neighboring blocks from among the mappedintra prediction modes of the neighboring blocks. As such, the reasonwhy a representative intra prediction mode having a smaller mode valueis that a smaller mode value is set to more often generated intraprediction modes. That is, if different intra prediction modes arepredicted from neighboring blocks, since an intra prediction mode havinga smaller mode value has a higher occurrence possibility, it ispreferable to select a prediction mode having a smaller mode value as apredictor for a prediction mode of a current block when there aredifferent prediction modes.

Sometimes, although a representative intra prediction mode is selectedfrom neighboring blocks, the representative intra prediction mode maynot be used as the representative intra prediction mode is as apredictor for an intra prediction mode of a current block. For example,if the current block A 120 has 33 intra prediction modes and arepresentative intra prediction mode has only 9 representative intraprediction modes, as described with reference to FIG. 12, an intraprediction mode of the current block A 120 corresponding to arepresentative intra prediction mode does not exist. In this case, in asimilar manner to that used to map intra prediction modes of neighboringblocks to a representative intra prediction mode as described above, anintra prediction mode having a most similar direction to arepresentative intra prediction mode selected from available intraprediction modes according to a size of a current block may be selectedas a final predictor for an intra prediction mode of the current block.For example, if a representative intra prediction mode finally selectedfrom neighboring blocks in FIG. 14 is a mode 6, an intra prediction modehaving a most similar directivity to that of the mode 6 from among intraprediction modes available according to the size of the current blockmay be finally selected as a predictor for the intra prediction mode ofthe current block.

Meanwhile, as described above with reference to FIG. 7, if a predictorfor the current pixel P is generated by using neighboring pixels on orclose to the extended line 700, the extended line 700 has actually adirectivity of tan⁻¹(dy/dx). Since division (dy/dx) is needed in orderto calculate the directivity, when hardware or software is used,calculation is made down to decimal places, thereby increasing theamount of calculation. Accordingly, it is preferable that when aprediction direction for selecting neighboring pixels to be used asreference pixels about a pixel in a block is set by using (dx, dy)parameters in a similar manner to that described with reference to Table1, dx and dy are set to reduce the amount of calculation.

FIG. 15 is a diagram for explaining a relationship between a currentpixel and neighboring pixels located on an extended line having adirectivity of (dx, dy), according to an exemplary embodiment.

Referring to FIG. 15, it is assumed that a location of a current pixel P1510 located on an ith place (i is an integer) based on an up border ofa current block and a jth place (j is an inter) based on a left borderof the current block is P(j,i), and an upper neighboring pixel and aleft neighboring pixel located on an extended line passing through thecurrent pixel P 1510 and having a directivity, that is, a gradient, oftan⁻¹(dy/dx) are respectively A 1520 and B 1530. Also, when it isassumed that locations of up neighboring pixels correspond to an X-axison a coordinate plane and locations of left neighboring pixelscorrespond to a Y-axis on the coordinate plate, it is found by using atrigonometric ratio that the upper neighboring pixel A 1520 meeting theextended line is located on (j+i*dx/dy,0) and the left neighboring pixelB 1530 meeting the extended line is located on (0,i+j*dy/dx).Accordingly, to determine any one of the up neighboring pixel A 1520 andthe left neighboring pixel B 1530 for predicting the current pixel P1510, division, such as dx/dy or dy/dx, is required. Since division isvery complex as described above, a calculation speed of software orhardware may be reduced.

Accordingly, a value of at least one of dx and dy representing adirectivity of a prediction mode for determining neighboring pixels usedfor intra prediction may be determined to be a power of 2. That is, whenn and m are integers, dx and dy may be respectively 2̂n and 2̂m.

Referring to FIG. 15, if the left neighboring pixel B 1530 is used as apredictor for the current pixel P 1510 and dx has a value of 2̂n, j*dy/dxneeded to determine (0,i+j*dy/dx) that is a location of the leftneighboring pixel B 1530 becomes (i*dy)/(2̂n), and division using such apower of 2 is easily obtained by shift operation as (i*dy)>>n therebyreducing the amount of calculation.

Likewise, if the up neighboring pixel A 1520 is used as a predictor forthe current pixel P 1510 and dy has a value of 2̂m, i*dx/dy needed todetermine (j+i*dx/dy,0) that is a location of the up neighboring pixel A1520 becomes (i*dx)/(2̂m), and division using such a power of 2 is easilyobtained by shift operation as (i*dx)>>m.

FIG. 16 is a diagram for explaining a change in a neighboring pixellocated on an extended line having a directivity of (dx, dy) accordingto a location of a current pixel, according to an exemplary embodiment.

One of an up neighboring pixel and a left neighboring pixel located onan extended line passing through a current pixel is selected as aneighboring pixel necessary for prediction according to a location ofthe current pixel and a gradient of the extended line.

Referring to FIG. 16, when a current pixel 1610 is P(j,i) and ispredicted by using a neighboring pixel located on an extended linehaving a gradient, an upper pixel A is used to predict the current pixelP 1610. When a current pixel 1620 is Q(b,a), a left pixel B is used topredict the current pixel Q 1620.

If only a dy component of a Y-axis direction from among (dx, dy)representing a prediction direction has a power of 2 like 2̂m, the upperpixel A in FIG. 16 may be determined by shift operation or the like as(j+(i*dx)>>m, 0) without division, but the left pixel B requiresdivision as shown in (0, a+b*2̂m/dx). Accordingly, in order to excludedivision when a predictor is generated for all pixels of a currentblock, all of dx and dy should have a type of power of 2.

FIGS. 17 and 18 are diagrams for explaining a method of determining anintra prediction mode direction, according to exemplary embodiments.

In general, there are many cases where linear patterns shown in an imageor a video signal are vertical or horizontal. Accordingly, when intraprediction modes having various directivities are defined by using (dx,dy) parameters, image coding efficiency may be improved by definingvalues of dx and dy. For example, an absolute values of dx and dy areset such that a distance between prediction directions close to ahorizontal direction or a vertical direction is narrow and a distancebetween prediction modes close to a diagonal direction is wide.

In detail, referring to FIG. 17, if dy has a fixed value of 2̂n, anabsolute value of dx may be set such that a distance between predictiondirections close to a vertical direction is narrow and a distancebetween prediction modes closer to a horizontal direction is wider. Inother words, an absolute value of dx may be set such that a distancebetween prediction directions close to a vertical direction is narrowand a distance between prediction modes closer to a diagonal(+45 or −45degree) direction is wider. That is, if dy has a fixed value that is apower of 2, a distance may be set to decrease as an absolute value of dxis closer to 0 such that the distance decreases as a direction of anextended line is closer to a vertical direction, and the distance may beset to increase as the absolute value of dx is farther from 0 such thatthe distance increases as the direction of the extended line is closerto a horizontal direction. For example, as shown in FIG. 17, if dy has avalue of 2̂4, that is, 16, a value of dx may be set to be 1,2,3,4,6,9,12,16,0,−1,−2,−3,−4,−6,−9,−12, and −16, such that a distance betweenextended lines close to a vertical direction may be narrow and adistance between extended lines close to a horizontal direction may bewide.

Likewise, when dx has a fixed value of 2̂n, an absolute value of dy maybe set such that a distance between prediction directions close to ahorizontal direction is narrow and a distance between prediction modescloser to a vertical direction is wider. In other words, an absolutevalue of dy may be set such that a distance between predictiondirections close to a horizontal direction is narrow and a distancebetween prediction modes closer to a diagonal(+45 or −45 degree)direction is wider. That is, when dx has a fixed value that is a powerof 2, a distance may be set to be reduced as an absolute value of dy iscloser to 0 such that the distance decreases as a direction of anextended line is closer to a horizontal direction, and the distance maybe set to increase as an absolute value of dy is farther from 0 suchthat the distance increases as the direction of the extended line iscloser to the horizontal direction. For example, as shown in FIG. 18,when dx has a value of 2̂4, that is, 16, a value of dy may be set to be1,2,3,4,6,9,12, 16,0,−1,−2,−3,−4,−6,−9,−12, and −16 such that a distancebetween extended lines close to a horizontal direction may be narrow anda distance between extended lines close to a vertical direction may bewide.

Also, when a value of any one of dx and dy is fixed, a value of theremaining one may be set to be increased according to a prediction mode.In detail, when dy is fixed, a distance between dxs may be set toincrease by a predetermined value. For example, if a value of dy isfixed to 16, dx may be set such that an absolute value differencebetween different dxs is increased by 1, like 0, 1, 3, 6, and 8. Also,an angle between a horizontal direction and a vertical direction may bedivided in predetermined units, and such an increased amount may be setin each of the divided angles. For example, if dy is fixed, a value ofdx may be set to have an increased amount of ‘a’ in a section less than15 degrees, an increased amount of ‘b’ in a section between 15 degreesand 30 degrees, and an increased amount of ‘c’ in a section grater than30 degrees. In this case, in order to have such a shape as shown in FIG.17, the value of dx may be set to satisfy a relationship of a<b<c.

Prediction modes described with reference to FIGS. 15 through 18 may bedefined as a prediction mode having a directivity of tan⁻¹(dy/dx) byusing (dx, dy) as shown in Table 2 through Table 4.

TABLE 2 dx dy −32 32 −26 32 −21 32 −17 32 −13 32 −9 32 −5 32 −2 32 0 322 32 5 32 9 32 13 32 17 32 21 32 26 32 32 32 32 −26 32 −21 32 −17 32 −1332 −9 32 −5 32 −2 32 0 32 2 32 5 32 9 32 13 32 17 32 21 32 26 32 32

TABLE 3 dx dy −32 32 −25 32 −19 32 −14 32 −10 32 −6 32 −3 32 −1 32 0 321 32 3 32 6 32 10 32 14 32 19 32 25 32 32 32 32 −25 32 −19 32 −14 32 −1032 −6 32 −3 32 −1 32 0 32 1 32 3 32 6 32 10 32 14 32 19 32 25 32 32

TABLE 4 dx dy −32 32 −27 32 −23 32 −19 32 −15 32 −11 32 −7 32 −3 32 0 323 32 7 32 11 32 15 32 19 32 23 32 27 32 32 32 32 −27 32 −23 32 −19 32−15 32 −11 32 −7 32 −3 32 0 32 3 32 7 32 11 32 15 32 19 32 23 32 27 3232

As described above with reference to FIG. 15, a location of a currentpixel P located on an ith place based on an up border of a current blockand a jth place based on a left border of the current block is P(j,i),and an upper neighboring pixel A and a left neighboring pixel B locatedon an extended line passing through the current pixel P and having agradient of tan⁻¹(dy/dx) are located on (j+i*dx/dy,0) and (0,i+j*dy/dx),respectively. Accordingly, when intra prediction is performed by usingsoftware or hardware, calculation like i*dx/dy or j*dy/dx is needed.

When calculation like i*dx/dy is needed, available values of dx/dy orC*dx/dy obtained by multiplying a predetermined constant C may be storedin a table and locations of neighboring pixels used to intra predict acurrent pixel may be determined by using the value stored in the tablewhich is previously prepared during actual intra prediction. That is,various values of (dx, dy) determined according to prediction modes asshown in Table 1 and available values of i*dx/dy considering a value of‘I’ determined according to a size of a block may be previously storedin a table and may be used during intra prediction. In detail, ifC*dx/dy has N different number of values, the N different number ofvalues of C*dx/dy may be stored as dyval_table[n] (n=0 . . . an integerto N−1).

Likewise, when calculation like j*dy/dx is needed, available values ofdy/dx or C*dy/dx obtained by multiplying a predetermined constant C maybe previously stored in a table and locations of neighboring pixels usedto intra predict a current pixel may be determined by using the valuesstored in the table that is previously prepared during actual intraprediction. That is, various values of (dx, dy) determined according toprediction modes as shown in Table 1 and available values of j*dy/dxconsidering a value of ‘j’ determined according to a size of a block maybe previously stored in a table and may be used for intra prediction. Indetail, when C*dy/dx has N different number of values, the N differentnumber of values of C*dy/dx may be stored as dxval_table[n] (n=0 . . .an integer to N−1).

As such, once values of C*dx/dy or C*dy/dx are previously stored in atable, locations of pixels of a neighboring block to be used to predicta current pixel may be determined by using values stored in the tablecorresponding to i*dx/dy and j*dy/dx without additional calculation.

For example, it is assumed that in order to form prediction modes in asimilar shape to that shown in FIG. 17, dy is 32, dx is one of {0, 2, 5,9, 13, 17, 21, 26, and 32}, and a constant C is 32. In this case, sinceC*dy/dx is 32*32/dx and has one from among values {0, 512, 205, 114, 79,60, 49, 39, and 32} according to a value of dx, the values {0, 512, 205,114, 79, 60, 49, 39, and 32} may be stored in a table and may be usedfor intra prediction.

FIG. 19 is a flowchart illustrating a method of encoding an imagethrough intra prediction, according to an exemplary embodiment.

Referring to FIG. 19, in operation 1910, a current picture is dividedinto at least one block having a predetermined size. As described above,the current picture is not limited to a macroblock having a size of16×16, and may be divided into blocks hazing sizes of 2×2, 4×4, 8×8,16×16, 32×32, 64×64, 128×128, or a greater size.

In operation 1920, a pixel of a neighboring block to be used to predicteach of pixels inside the current block is determined from among pixelsof the neighboring block which are previously reconstructed by using anextended line having a predetermined gradient. As described above, alocation of a current pixel P located on an ith place based on an upperborder of the current block and located on a jth place based on a leftborder of the current block is P(j,i), and an up neighboring pixel and aleft neighboring pixel located on an extended line passing through thecurrent pixel P and having a gradient of tan⁻¹(dy/dx) are locatedrespectively on (j+i*dx/dy,0) and (0,i+j*dy/dx). In order to reduce theamount of calculation of dx/dy and dy/dx needed to determine thelocation of the neighboring pixel, it is preferable that a value of atleast one of dx and dy is a power of 2. Also, if available values ofdx/dy and dy/dx or values obtained by multiplying the values of dx/dyand dy/dx by a predetermined constant are previously stored in a table,the pixel of the neighboring block may be determined by searching forcorresponding values in the table without additional calculation.

In operation 1930, each of the pixels inside the current block ispredicted by using the determined pixel of the neighboring block. Thatis, a pixel value of the neighboring block is predicted as a pixel valueof the current block, and a prediction block of the current block isgenerated by repeatedly performing the above operations on each of thepixels inside the current block.

FIG. 20 is a block diagram illustrating an apparatus 2000 for decodingan image, according to an exemplary embodiment.

Referring to FIG. 20, the apparatus 2000 includes a parsing unit 2010,an entropy decoder unit 2020, an inverse quantization unit 2030, afrequency-inverse transformation unit 2040, an intra prediction unit2050, a motion compensation unit 2060, a deblocking unit 2070, and aloop filtering unit 2080. Here, the intra prediction unit 2050corresponds to an apparatus for decoding an image through intraprediction.

A bitstream 2005 passes through the parsing unit 2010, and encodinginformation needed for decoding and image data of a current block to bedecoded are extracted. Encoded image data is output as inverse quantizeddata through the entropy decoding unit 2020 and the inverse quantizationunit 2030, and is restored as residual values through the frequencyinverse transformation unit 2040.

The motion compensation unit 2060 and the intra prediction unit 2050generate a prediction block of the current block by using the parsedencoding information of the current block. In particular, the intraprediction unit 2050 determines a pixel of a neighboring block to beused to predict each of pixels inside the current block from amongpixels of the neighboring block which are previously reconstucted byusing an extended line having a predetermined gradient determinedaccording to an intra prediction mode included in the bitstream. Asdescribed above, in order to reduce the amount of calculation of dx/dyand dy/dx needed to determine a location of the neighboring pixel, it ispreferable that a value of at least one of dx and dy is a power of 2.Also, the intra prediction unit 2050 may previously store availablevalues of dx/dy and dy/dx or values obtained by multiplying the valuesof dx/dy and dy/dx by a predetermined constant in a table, determine apixel of a neighboring block by searching for corresponding values inthe table, and perform intra prediction by using the determined pixel ofthe neighboring block.

A prediction block generated in the motion compensation unit 2060 or theintra prediction unit 2050 is added to the residual values to restorethe current frame 2095. The restored current frame may be used asreference frame 2085 of a next block through the deblocking unit 2070and the loop filtering unit 2080.

FIG. 21 is a flowchart illustrating a method of decoding an imagethrough intra prediction, according to an exemplary embodiment.

Referring to FIG. 21, in operation 2110, a current picture is dividedinto at least one block having a predetermined size.

In operation 2120, intra prediction mode information applied to thecurrent block to be decoded is extracted from a bitstream. The intraprediction mode information may be a mode difference value between anactual intra prediction mode and a predicted intra prediction modepredicted from neighboring blocks of a current block or mode values ofintra prediction modes having various directivities defined by using(dx, dy) parameters as described above. If the mode difference value istransmitted as prediction mode information, the intra prediction unit2050 may predict and determine a predicted intra prediction mode of thecurrent block from intra prediction modes of neighboring blocks whichare previously decoded, and determine an intra prediction mode of thecurrent block by adding a mode difference value extracted from thebitstream to a mode value of the predicted prediction intra predictionmode.

In operation 2130, the intra prediction unit 2050 determines a pixel ofa neighboring block to be used to predict each of pixels inside thecurrent block from among pixels of the neighboring block which arepreviously reconstructed by using an extended line having apredetermined gradient according to the extracted prediction mode. Asdescribed above, a location of a current pixel P located on an ith placebased on an upper border of the current block and a jth place based on aleft border of the current block is P(j,i), and an upper neighboringpixel and a left neighboring pixel located on an extended line passingthrough the current pixel P and having a gradient of tan⁼(dy/dx) arerespectively located on (j+i*dx/dy,0) and (0,i+j*dy/dx). In order toreduce the amount of calculation of dx/dy and dy/dx needed to determinea location of a neighboring pixel, it is preferable that a value of atleast one of dx and dy is a power of 2. Also, available values of dx/dyand dy/dx or values obtained by multiplying the values of dx/dy anddy/dx by a predetermined constant may be previously stored in a tableand a pixel of a neighboring block may be determined by searching forcorresponding values in the table. The intra prediction unit 2050predicts a pixel value of the determined neighboring block as a pixelvalue of the current block, and a prediction block of the current blockis generated by repeatedly performing the above operations on each ofthe pixels inside the current block.

The exemplary embodiments may be written as computer programs and can beimplemented in general-use digital computers that execute the programsusing a computer readable recording medium. Examples of the computerreadable recording medium include magnetic storage media (e.g., ROM,floppy disks, hard disks, etc.) and optical recording media (e.g.,CD-ROMs, or DVDs).

The apparatuses, encoders, and decoders of the exemplary embodiments mayinclude a bus coupled to every unit of the apparatus, at least oneprocessor (e.g., central processing unit, microprocessor, etc.) that isconnected to the bus for controlling the operations of the apparatusesto implement the above-described functions and executing commands, and amemory connected to the bus to store the commands, received messages,and generated messages.

While this invention has been particularly shown and described withreference to preferred embodiments thereof, it will be understood bythose of ordinary skill in the art that various changes in form anddetails may be made therein without departing from the spirit and scopeof the invention as defined by the appended claims. The preferredembodiments should be considered in descriptive sense only and not forpurposes of limitation. Therefore, the scope of the invention is definednot by the detailed description of the invention but by the appendedclaims, and all differences within the scope will be construed as beingincluded in the present invention.

What is claimed is:
 1. An apparatus configured to decode an image, theapparatus comprising: an entropy decoder which extracts an intraprediction mode of a current block from a bitstream, the intraprediction mode indicating a particular direction among a plurality ofdirections, wherein the particular direction is indicated by using oneof a dx number in a horizontal direction and a fixed number in avertical direction, or a dy number in the vertical direction and a fixednumber in the horizontal direction, wherein dx and dy are integers; andan intra prediction performer which determines a number of neighboringpixels located on a left side of the current block or an upper side ofthe current block, determines a location of one or more neighboringpixels among the neighboring pixels located on the left side of thecurrent block or the upper side of the current block using a bitwiseshift operation based on a position of a current pixel (j, i) and one ofthe dx or dy numbers indicating the particular direction, where j and iare integers; and performs intra prediction on the current block usingthe number of neighboring pixels and the location of the one or moreneighboring pixels, wherein the intra prediction performer obtains avalue of the current pixel using the number of neighboring pixels, andthe location of the one or more neighboring pixels, wherein: thelocation of the one or more neighboring pixels located on the upper sideof the current block is determined based on i*dx>>m, where i is aposition of the current pixel in the vertical direction, dx is the dxnumber in the horizontal direction, m is related to the fixed number inthe vertical direction, and >> is the bitwise shift operation, and thelocation of the one or more neighboring pixels located on the left sideof the current block is determined based on j*dy>>n, where j is aposition of the current pixel in the horizontal direction, dy is the dynumber in the vertical direction, and n is related to the fixed numberin the horizontal direction, wherein the bitwise shift operationoperates on a binary representation of i*dx and j*dy.